#ifndef __CONTROLLER_CONNECTION_H_
#define __CONTROLLER_CONNECTION_H_

#include "Include.h"
#include "Socket.h"
#include "Data.h"

class Renderer : public ACE_Task<ACE_MT_SYNCH> 
{
public:
	static std::vector<Renderer*> g_vecRenderer;
	static void Finish();
	static int Dist(const _JOB_INFO & job_info);

	static SocketWorker * g_worker; 
	static bool g_bClosed;

public:

	ACE_Thread_Mutex renderer_lock;

	bool stop;

	_JOB_INFO job_info;


	bool isWorking();
	void Clear();


	Renderer()
	{
		stop = false;
	}


	void Work();

	int Stop();

	int svc();


};


class ControllerWorker : public SocketWorker
{

public:
  ControllerWorker () 
  {
  }

  ~ControllerWorker()
  {
	  printf("[agent %d] delete ControllerWorker\n" , getpid());
  }


public:


  virtual bool Execute(const std::string &rcv_text);

  static bool Start(ACE_Reactor * reactor);
  virtual int handle_close (ACE_HANDLE h, ACE_Reactor_Mask mask);

};


#endif
